#!/bin/perl
use strict;
use warnings;

my $color_info_key = "\e[0;34m";
my $color_info_msg = "\e[0;33m";
my $color_error_key = "\e[0;34m";
my $color_error_msg = "\e[1;31m";
my $color_module = "\e[0;35m";
my $color_normal = "\e[0m";

while (<>) {
	if (m{
			\[!
				([a-z-]+)
				(:[:a-z-]+)?
			\]
			\s*
			(.*)
		}x) {
		my $mod = ($2 ? $color_module . $2 : '');
		print "$color_error_key\[$1\]$mod $color_error_msg$3$color_normal\n";
		next;
	}

	if (m{
			\[
				([a-z-]+)
				(:[:a-z-]+)?
			\]
			\s*
			(.*)
		}x) {
		my $mod = ($2 ? $color_module . $2 : '');
		print "$color_info_key\[$1\]$mod $color_info_msg$3$color_normal\n";
		next;
	}

	print;
}

